


import uk.ac.shef.wit.simmetrics.similaritymetrics.CosineSimilarity;
public class CosineSimilarityForRs {
	public static double getSimilarity (String s1, String s2, boolean rejectNumber) {
		//System.out.println (s1 +"\n" + s2);
		CosineSimilarity c = new CosineSimilarity();
		float t = 0;
		if (rejectNumber) {
			t = c.getSimilarity(s1.replaceAll("\\d+", "").replace(' ', ' '), s2.replaceAll("\\d+", "").replace(' ', ' '));
			//System.out.println(t);
		}
		else {
			if (s1.equals("0")&& s2.equals("0")) return 0.5;
			else if (s1.equals("0")|| s2.equals("0")) return 0;
			t = c.getSimilarity(s1, s2);
			//System.out.println (s1 +"\t" + s2 +" :" + t);
		}
		//System.out.println (t);
		return t;
	}
	
}
